#include<bits/stdc++.h>
using namespace std;
int n,q,a[8010],b[8010];
int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&q);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		b[i]=a[i];
	}
	sort(b+1,b+1+n);
	for(int i=1,in,v,x;i<=q;i++)
	{
		scanf("%d",&in);
		if(in==1)
		{
			scanf("%d%d",&x,&v);
			b[lower_bound(b+1,b+1+n,a[x])-b]=v;
			sort(b+1,b+1+n);
			a[x]=v;
		}
		else
		{
			scanf("%d",&x);
			printf("%d\n",lower_bound(b+1,b+1+n,a[x])-b);
		}
	}
	return 0;
}
